Page({
    data: {
        message: 'Hello ASCF2222',
        srcimg:'https://img2.baidu.com/it/u=4046032575,170739907&fm=253&fmt=auto&app=138&f=JPEG?w=479&h=500',
        communityName:'ss',
        communityPic:'',
    },
    observers:{
        'communityName':function(communityName){
            this.setData({
                communityName:this.data.communityName
            })
        }
},
    getPhotoFun(){
        has.chooseImage({
            count:1,
            sourceType: ['album', 'camera'],
            success:(res)=>{
                console.log('pkl-chooseImage---成功')
                console.log('pkl-chooseImage--res.tempFilePaths',res.tempFilePaths,res.tempFilePaths[0])
                has.saveImageToPhotosAlbum({
                    filePath: res.tempFilePaths[0],
                    success(errMsg) {
                        console.log('pkl-chooseImage-saveImageToPhotosAlbum success',errMsg)
                    },
                    fail(res) {
                        console.log('saveImageToPhotosAlbum fail')
                    },
                    complete(res) {
                        console.log('saveImageToPhotosAlbum complete')
                    }
                })
                this.setData({
                    //刷新渲染
                    // srcimg:res.tempFilePaths[0]----不展示临时路径
                    srcimg:'https://img.soogif.com/ECm8MKe1JrV57Hd0ItkPpRf47JDyRZo2.gif'
                })
            },
            file:()=>{
                console.log('pkl-chooseImage---失败')
            }
        })

    },
    getStoreList(){

        has.request({
            url: 'https://openatom.atomgit.com/api/community/getCommunityInfo', //仅为示例，并非真实的接口地址
            header: {
                'content-type': 'application/json',
                "X-ATOMGIT-POP-COMMUNITY":"openatom"
            },
            success:(res)=> {
                console.log('pkl---request',res.data.data)
                console.log('pkl---request',res.data.data.communityPic)
                console.log('pkl---request',res.data.data['communityName'])

                this.setData({
                    //刷新渲染
                    communityPic:res.data.data.communityPic,
                    communityName:res.data.data['communityName']
                })
            }
        })

    }
});